//
//  ReplenishmentRecordTableCell.m
//  MiYuan_iOS
//
//  Created by zhangyongbing on 2018/5/16.
//  Copyright © 2018年 zhangyongbing. All rights reserved.
//

#import "ReplenishmentRecordTableCell.h"

@interface ReplenishmentRecordTableCell()
@property (nonatomic,weak) IBOutlet   UIImageView     *imgIcon;
@property (nonatomic,weak) IBOutlet   UILabel         *labTitle;
@property (nonatomic,weak) IBOutlet   UILabel         *labNumber;
@property (nonatomic,weak) IBOutlet   UILabel         *labtitme;

@end;

@implementation ReplenishmentRecordTableCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    CGColorRef color = [UIColor colorWSHHFromHexString:@"#F1F1F1"].CGColor;
    [self.imgIcon.layer setMasksToBounds:YES];
    [self.imgIcon.layer setCornerRadius:2]; //设置矩形四个圆角半径
    [self.imgIcon.layer setBorderWidth:1]; //边框宽度
    [self.imgIcon.layer setBorderColor:color];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setDataToViewWithDictionary:(NSDictionary *)dic
{
    [self.labTitle setText:[dic objectForKey:@"numbers"]];
    NSString *numbers = [NSString stringWithFormat:@"%@",[dic objectForKey:@"numbers"]];
    if ([numbers stringIsValid]) {
        [self.labNumber setText:numbers];
    }
    else{
        [self.labNumber setText:@""];
    }
    NSString *number = [NSString stringWithFormat:@"%@",[dic objectForKey:@"number"]];
    if ([number stringIsValid]) {
        [self.labTitle setText:number];
    }
    else{
        [self.labTitle setText:@""];
    }
    
    NSString *replenishmentTime = [NSString stringWithFormat:@"%@",[dic objectForKey:@"replenishmentTime"]];
    if ([replenishmentTime stringIsValid]) {
        [self.labtitme setText:replenishmentTime];
    }
    else{
        [self.labtitme setText:@""];
    }
    
    NSString *imgurl =[NSString stringWithFormat:@"%@",[dic objectForKey:@"picture"]];
    if ([imgurl stringIsValid]) {
        [self.imgIcon sd_setImageWithURL:[NSURL URLWithString:imgurl] placeholderImage:[UIImage imageNamed:@"defautMachine"]];
    }
    else
    {
        [self.imgIcon setImage:[UIImage imageNamed:@"defautMachine"]];
    }
    
}

@end
